import { Component } from "vue";
import { ComType } from "../type";
import {
  ElButton,
  ElAutocomplete,
  ElCascader,
  ElCheckbox,
  ElDatePicker,
  ElInput,
  ElInputNumber,
  ElRate,
  ElSlider,
  ElSwitch,
  ElTreeSelect,
  ElColorPicker
} from "element-plus";
import RadioGroup from "../component/RadioGroup/index.vue";
import RadioButtonGroup from "../component/RadioButtonGroup/index.vue";
import Select from "../component/Select/index.vue";
import ApiSelect from "../component/ApiSelect/index.vue";
import InputColorPicker from "../component/InputColorPicker/index.vue";
import { IconPicker } from "@/components/Icon";
const componentMap = new Map<ComType, Component>();
componentMap.set("button", ElButton);
componentMap.set("autocomplete", ElAutocomplete);
componentMap.set("cascader", ElCascader);
componentMap.set("checkbox", ElCheckbox);
componentMap.set("datePicker", ElDatePicker);
componentMap.set("input", ElInput);
componentMap.set("number", ElInputNumber);
componentMap.set("rate", ElRate);
componentMap.set("slider", ElSlider);
componentMap.set("switch", ElSwitch);
componentMap.set("tree-select", ElTreeSelect);
componentMap.set("color-picker", ElColorPicker);
componentMap.set("radio-group", RadioGroup);
componentMap.set("radio-button-group", RadioButtonGroup);
componentMap.set("select", Select);
componentMap.set("api-select", ApiSelect);
componentMap.set("input-color-picker", InputColorPicker);
componentMap.set("icon-picker", IconPicker);

export const useCom = (com: ComType): Component => {
  return componentMap.get(com);
};
